package logic

import (
	"context"
	"goodsrpc/mysql"

	"goodsrpc/goods"
	"goodsrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UpdateStateLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUpdateStateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateStateLogic {
	return &UpdateStateLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UpdateStateLogic) UpdateState(in *goods.UpdateStateRequest) (*goods.UpdateStateResponse, error) {
	// todo: add your logic here and delete this line
	var o mysql.Order
	err := o.UpdateState(in.OrderNo, in.State)
	if err != nil {

		return nil, err
	}

	return &goods.UpdateStateResponse{}, nil
}
